/**筛选Tab */
import { Tabs } from 'antd';

import React from 'react';

const { TabPane } = Tabs;

const ScreenTab = (props: { setParams: any }) => {
  const { setParams } = props;
  const tabArr = [
    { name: '全部', id: 0 },
    { name: '待审核', id: 1 },
    { name: '进行中', id: 2 },
    { name: '未开始', id: 3 },
    { name: '已驳回', id: 4 },
    { name: '已结束', id: 5 },
    { name: '草稿箱', id: 6 },
  ];
  const tabChange = (key: string) => {
    if (key === '6') {
      setParams((val: { activityStatus: string }) => ({
        ...val,
        // activityName: '',
        // queryStartDate: '',
        // queryEndDate: '',
        activityStatus: [],
        isDraft: 1,
        page: 1,
        pageSize: 10,
      }));
    } else if (key === '0') {
      setParams((val: { activityStatus: string }) => ({
        ...val,
        // activityName: '',
        // queryStartDate: '',
        // queryEndDate: '',
        activityStatus: [],
        isDraft: '',
        page: 1,
        pageSize: 10,
      }));
    } else {
      setParams((val: { activityStatus: string }) => ({
        ...val,
        // activityName: '',
        // queryStartDate: '',
        // queryEndDate: '',
        activityStatus: [key],
        isDraft: '',
        page: 1,
        pageSize: 10,
      }));
    }
  };
  return (
    <div style={{ marginBottom: 10 }}>
      <Tabs defaultActiveKey="0" onChange={tabChange}>
        {tabArr.map((item) => (
          <TabPane tab={item.name} key={item.id} />
        ))}
      </Tabs>
    </div>
  );
};
export default ScreenTab;
